package com.hundsun.fcp.common;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.widget.Toast;

import com.hundsun.fcp.activity.BankAddActivity;
import com.hundsun.fcp.activity.BankAddStepTwoActivity;
import com.hundsun.fcp.activity.BankManagerActivity;
import com.hundsun.fcp.activity.LockPatternCreateActivity;
import com.hundsun.fcp.activity.LoginActivity;
import com.hundsun.fcp.activity.MineAccountInfoActivity;
import com.hundsun.fcp.activity.MineAccountSecurityActivity;
import com.hundsun.fcp.activity.MineActionCenterActivity;
import com.hundsun.fcp.activity.MineBindingMobileActivity;
import com.hundsun.fcp.activity.MineIdAuthActivity;
import com.hundsun.fcp.activity.MineModifyGesturePwdActivity;
import com.hundsun.fcp.activity.MineModifyLoginPwdActivity;
import com.hundsun.fcp.activity.MineModifyMobileActivity;
import com.hundsun.fcp.activity.MineModifyNicknameActivity;
import com.hundsun.fcp.activity.MineModifyTransPwdActivity;
import com.hundsun.fcp.activity.MineMsgCenterActivity;
import com.hundsun.fcp.activity.MineResetLoginPwdActivity;
import com.hundsun.fcp.activity.MineResetTransPwdActivity;
import com.hundsun.fcp.activity.MineShareActivity;
import com.hundsun.fcp.activity.SignupActivity;
import com.hundsun.fcp.activity.UnlockPatternActivity;
import com.hundsun.fcp.activity.WebViewActivity;
import com.hundsun.fcp.common.AppointFiled.IntentKeyDef;
import com.hundsun.fcp.common.AppointFiled.RequestCodeDef;
import com.hundsun.fcp.dialog.UIToast;

public class Redirect {

	/**
	 * 打开账户安全
	 * 
	 * @param context
	 */
	public static void startAccSecurity(Context context) {
		Intent intent = new Intent();
		intent.setClass(context, MineAccountSecurityActivity.class);
		context.startActivity(intent);
	}

	/**
	 * 打开我的银行卡
	 * 
	 * @param context
	 */
	public static void startBankManager(Context context) {
		Intent intent = new Intent(context, BankManagerActivity.class);
		context.startActivity(intent);
	}

	/**
	 * 添加银行卡
	 * 
	 * @param context
	 */
	public static void startBankAdd(Context context) {
		Intent intent = new Intent(context, BankAddActivity.class);
		context.startActivity(intent);
	}

	/**
	 * 填写银行卡信息
	 * 
	 * @param context
	 */
	public static void startBankAddStep(Context context) {
		Intent intent = new Intent(context, BankAddStepTwoActivity.class);
		context.startActivity(intent);
	}
	/**
	 * 打开登陆界面
	 */

	public static void startLogin(Context context) {
		Intent intent = new Intent(context, LoginActivity.class);
		context.startActivity(intent);
	}
	/**
	 * 打开注册界面
	 */
	
	public static void startSignUp(Context context) {
		Intent intent = new Intent(context, SignupActivity.class);
		context.startActivity(intent);
	}
	/**
	 * 修改登录密码
	 */
	public static void startModifyLoginPwd(Context context) {
		Intent intent = new Intent();
		intent.setClass(context, MineModifyLoginPwdActivity.class);
		context.startActivity(intent);
	}

	/**
	 * 修改交易密码
	 */
	public static void startModifyTransPwd(Context context) {
		Intent intent = new Intent();
		intent.setClass(context, MineModifyTransPwdActivity.class);
		context.startActivity(intent);
	}

	/**
	 * 找回交易密码
	 */
	public static void startResetTransPwd(Context context) {
		Intent intent = new Intent();
		intent.setClass(context, MineResetTransPwdActivity.class);
		context.startActivity(intent);
	}

	/**
	 * 修改手势密码（登陆密码验证界面）
	 */
	public static void startModifyGesturePwd(Activity context,int requestCode) {
		Intent intent = new Intent();
		intent.setClass(context, MineModifyGesturePwdActivity.class);
		context.startActivityForResult(intent, requestCode);
	}

	/**
	 * 跳转到账号信息
	 */
	public static void startAccInfo(Context context) {
		Intent intent = new Intent();
		intent.setClass(context, MineAccountInfoActivity.class);
		context.startActivity(intent);
	}

	/**
	 * 修改用户昵称
	 */
	public static void startModifyNickname(Context context,String oldName) {
		Intent intent = new Intent();
		intent.setClass(context, MineModifyNicknameActivity.class);
		intent.putExtra(IntentKeyDef.USERITEM_OLD, oldName) ;
		context.startActivity(intent);
	}

	/**
	 * 绑定手机
	 */
	public static void startBindingMobile(Context context) {
		Intent intent = new Intent();
		intent.setClass(context, MineBindingMobileActivity.class);
		context.startActivity(intent);
	}

	/**
	 * 更换绑定手机
	 */
	public static void startModifyMobile(Context context) {
		Intent intent = new Intent();
		intent.setClass(context, MineModifyMobileActivity.class);
		context.startActivity(intent);
	}

	/**
	 * 身份认证
	 */
	public static void startIdAuth(Context context) {
		Intent intent = new Intent();
		intent.setClass(context, MineIdAuthActivity.class);
		context.startActivity(intent);
	}

	/**
	 * 重置登陆密码
	 */
	public static void startResetLoginPwd(Context context) {
		Intent intent = new Intent();
		intent.setClass(context, MineResetLoginPwdActivity.class);
		context.startActivity(intent);
	}

	/**
	 * 打开消息中心
	 */
	public static void startMsgCenterActivity(Context context) {
		Intent intent = new Intent();
		intent.setClass(context, MineMsgCenterActivity.class);
		context.startActivity(intent);
	}
	/**
	 * 推荐给朋友
	 */
	public static void startShareActivity(Context context){
		Intent intent = new Intent(context, MineShareActivity.class);
		context.startActivity(intent);
	}
	
	/**
	 * 打开手势解锁密码
	 * @param context
	 */
	public static void startUnLockActivity(Context context){
		context.startActivity(new Intent(context, UnlockPatternActivity.class));
	}
	
	/**
	 * 打开手势密码设置
	 * @param pContext
	 */
	public static void startCreateLockPattern(Context context){
		Intent intent = new Intent();
		intent.setClass(context,LockPatternCreateActivity.class);
		((Activity)context).startActivityForResult(intent,RequestCodeDef.PARTTERN_REQUEST_CODE_CREATE);
	}
	/**
	 * 打开活动中心
	 */
	
	public static void startMineActionCenter(Context context){
		Intent intent = new Intent(context, MineActionCenterActivity.class);
		context.startActivity(intent);
	}
	
	/**
	 * 显示Toast信息
	 */
	
	public static void makeToast(final Context context, final int resId) {
		new Handler(context.getMainLooper()).post(new Runnable() {
			
			@Override
			public void run() {
				Toast.makeText(context, resId, Toast.LENGTH_LONG).show();
			}
		});

	}
	
	public static void makeToast(final Context context, final String text) {
		new Handler(context.getMainLooper()).post(new Runnable() {
			
			@Override
			public void run() {
				//Toast.makeText(context, text, Toast.LENGTH_LONG).show();
				UIToast.show(context, text) ;
			}
		});

	}

	/**
	 * 启动web 界面
	 * @param context
	 * @param url
	 * @param title
	 */
	public static void startWebView(
			Context context, String url,
			String title) {
		Intent intent = new Intent();
		intent.putExtra(IntentKeyDef.WEBVIEW_URL, url) ;
		intent.putExtra(IntentKeyDef.WEBVIEW_TITLE, title) ;
		intent.setClass(context, WebViewActivity.class);
		context.startActivity(intent);
	}
}
